Skip to content

Add Pulseq ROTATIONS support via extension hooks#730

Open
cncastillo wants to merge 1 commit intomasterfrom
codex/pulseq-extensions-rotations
Open

Add Pulseq ROTATIONS support via extension hooks#730
cncastillo wants to merge 1 commit intomasterfrom
codex/pulseq-extensions-rotations

Conversation

@cncastillo
Copy link
Member

Summary

  • Add QuaternionRot <: Extension in KomaMRIBase with hook methods:
    • get_scale(::Type{QuaternionRot})
    • get_scanf_format(::Type{QuaternionRot})
    • get_EXT_type_from_symbol(::Val{:ROTATIONS})
  • Add quaternion rotation operations:
    • Base.:*(q::QuaternionRot, grads)
    • Base.transpose(q::QuaternionRot) and Base.adjoint(q::QuaternionRot)
    • apply_rotations!(seq; reverse=false)
  • Wire the new extension through KomaMRIBase/src/datatypes/sequence/EXT.jl exports/includes.
  • Extend KomaMRIFiles.read_seq with apply_rotations=true kwarg and apply rotations at the end of parsing by default.
  • Add tests in KomaMRIBase and KomaMRIFiles (including lps.seq fixture) for forward/reverse rotation behavior and read-time application control.

References

Validation

  • julia --project=test -q --startup-file=no test/runtests.jl in KomaMRIBase: 211/211 passed
  • julia --project=test -q --startup-file=no test/runtests.jl in KomaMRIFiles: 24270/24270 passed

Note

For the specific lps.seq sequence in #728, the resulting rotation behavior still does not appear fully correct end-to-end. However, for trapezoids and simpler gradients, the quaternion rotation path appears to behave as expected based on the added unit/integration tests.

@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 88.46154% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.96%. Comparing base (21a7c25) to head (91c074e).

Files with missing lines Patch % Lines
...src/datatypes/sequence/extensions/QuaternionRot.jl 86.95% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #730      +/-   ##
==========================================
- Coverage   91.03%   88.96%   -2.07%     
==========================================
  Files          61       62       +1     
  Lines        3357     3380      +23     
==========================================
- Hits         3056     3007      -49     
- Misses        301      373      +72     
Flag Coverage Δ
base 90.79% <86.95%> (-0.08%) ⬇️
core 77.44% <ø> (-12.30%) ⬇️
files 94.57% <100.00%> (+0.01%) ⬆️
komamri 88.13% <ø> (ø)
plots 91.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
KomaMRIBase/src/KomaMRIBase.jl 100.00% <ø> (ø)
KomaMRIBase/src/datatypes/sequence/EXT.jl 0.00% <ø> (ø)
KomaMRIFiles/src/Sequence/Pulseq.jl 93.53% <100.00%> (+0.02%) ⬆️
...src/datatypes/sequence/extensions/QuaternionRot.jl 86.95% <86.95%> (ø)

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error loading extension ROTATIONS from Pulseq 1.5.1

1 participant